package com.laot.searchManage.controller;

import com.laot.searchManage.utils.UserUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.laot.seacher_master.model.common.BaseResponse;
import org.laot.seacher_master.model.common.ResultUtils;
import org.laot.seacher_master.model.entity.User;
import org.laot.searchManage.service.IDynamicMenusService;
import org.laot.searchManage.service.INoticeBoardService;
import org.laot.searchManage.vo.MenusInfoVo;
import org.laot.searchManage.vo.NoticeBoardVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**
 * 管理端动态菜单路由
 * @author laoT
 * @date 2024/2/2
 */
@Slf4j
@Api(tags = "管理端动态菜单路由")
@RestController
@RequestMapping("/menus")
public class DynamicMenusController {

    @Resource
    private IDynamicMenusService dynamicMenusService;
    @Resource
    private UserUtils userUtils;

    @GetMapping("/getInfo")
    @ApiOperation("获取菜单路由信息")
    public BaseResponse<MenusInfoVo> getInfo(HttpServletRequest request){
        //获取用户
        User user = userUtils.getLoginUser(request);
        MenusInfoVo menusInfoVo = dynamicMenusService.getInfo(user);
        return ResultUtils.success(menusInfoVo);
    }

}
